<!DOCTYPE html>
<html>
  <head>
    <title>index.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <link rel="stylesheet" type="text/css" href="css/base.css">
    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
    <script type="text/javascript" src="js/cookie_util"></script>
<style type="text/css">
<!--

-->
</style>
<script type="text/javascript">
	function commitLog() {
		var userid = $("#userid").val();
		var pwd = $("#pwd").val();
		$.ajax({
			url : "DrivingMan/log/login.do",
			type : "post",
			data : {
				"user_Id" : userid,
				"pass_word" : pwd
			},
			dataType : "json",
			success : function(result) {
				if (result.status == "0000") {
					addCookie("userId", userid, 2);
					alert(result.detail);
					window.open("qryCar.html");
				} else {
					alert(result.detail);
					window.location.reload();
				}
			},
			error : function() {
				alert("系统异常请稍后再试！");
				window.location.reload();
			}
		});
	}
	function commitRes() {
		var userid = $("#ruserid").val();
		var pwd = $("#rpwd").val();
		var pwd1 = $("#rpwd1").val();
		console.log(userid, pwd, pwd1);
		if (userid == null || pwd == null || pwd1 == null) {
			alert("用户名或密码不能为空");
			$("#reserid").val("");
			$("#rpwd").val("");
			$("#rpwd1").val("");
		}
		if (pwd != pwd1) {
			alert("两次输入密码不一致，请重新输入!");
			$("#reserid").val("");
			$("#rpwd").val("");
			$("#rpwd1").val("");
		}
		$.ajax({
			url : "DrivingMan/log/res.do",
			type : "post",
			data : {
				"userid" : ruserid,
				"pwd" : rpwd
			},
			dataType : "json",
			success : function(result) {
				if (result.status == "0000") {
					alert(result.detail);
					window.location.reload();
				} else {
					alert(result.detail);
					window.location.reload();
				}
			},
			error : function() {
				alert("系统异常请稍后再试！");
				window.location.reload();
			}
		});
	}
</script>
  </head>
  
  <body>
     <div class="login-head"></div>
    <div class="login-pane">
        <div class="login-sysname">
            欢迎使用试驾车管理系统
        </div>
        <div class="login-desc">
            <div class="login-desc-logo"><img src="img/logicon.jpg" height="140" alt="" /></div>
        </div>
        <div id="log-func">
		<div class="wrap-log"> 
		<label>
			<span>用户名</span> 
			<input type="text" placeholder="请输入用户名" class="logint" id="userid" />
		</label>
		<label>
			<span>密码</span> 
			<input type="password" placeholder="请输入密码" class="logint" id="pwd" />
		</label> 
		<label>
			<input type="button" value="登录" class="logbut" onclick="commitLog()" /> 
			<input type="button" value="返回" class="logbut" onclick="cancelLog()" />
		</label> 
		</div>
		</div>
	<div id="res-func">
		<div class="wrap-res">
			<label> <span>用户名</span><br /> <input type="text"
				placeholder="请输入用户名/邮箱/手机号" class="textinp" id="ruserid" /> </label> <label>
				<span>密码</span><br /> <input type="password" placeholder="请输入密码"
				class="textinp" id="rpwd" /> </label> <label> <span>确认密码</span><br />
				<input type="password" placeholder="请再起确认密码" class="textinp"
				id="rpwd1" /> </label> <label> <input type="button" value="注册"
				class="logbut" onclick="commitRes()" /> <input type="button"
				value="返回" class="logbut" onclick="cancelRes()" /> </label>
		</div>
	</div>
    </div>

  </body>
</html>
